title: How to set the default XML namespace for an XDocument
body: <p>How can I set the default namespace of an existing XDocument (so I can deserialize it with DataContractSerializer). I tried the following:</p>
  
  <pre><code>var doc = XDocument.Parse("&lt;widget/&gt;");
  var attrib = new XAttribute("xmlns",
                              "http://schemas.datacontract.org/2004/07/Widgets");
  doc.Root.Add(attrib);
  </code></pre>
  
  <p>The exception I get is is <code>The prefix '' cannot be redefined from '' to 'http://schemas.datacontract.org/2004/07/Widgets' within the same start element tag.</code> </p>
  
  <p>Any ideas?</p>