title: Namespace without prefix in XML in R
body: <p>In the <a href="https://cran.r-project.org/web/packages/XML/index.html" rel="nofollow noreferrer">XML</a> package in R, it is possible to create a new <a href="https://www.rdocumentation.org/packages/XML/versions/3.99-0.10/topics/xmlTree" rel="nofollow noreferrer">xmlTree</a> object with a namespace, e.g. using:</p>
  <pre><code>library(XML)
  d = xmlTree(&quot;foo&quot;, namespaces = list(prefix = &quot;url&quot;))
  d$doc()
  # &lt;?xml version=&quot;1.0&quot;?&gt;
  # &lt;foo xmlns:prefix=&quot;url&quot;/&gt;
  </code></pre>
  <p>How do I create a default namespace, without the prefix <em>bar</em>, such that it looks like the following?</p>
  <pre><code># &lt;?xml version=&quot;1.0&quot;?&gt;
  # &lt;foo xmlns=&quot;url&quot;/&gt;
  </code></pre>
  <p>The following does not produce what I expected.</p>
  <pre><code>library(XML)
  d = xmlTree(&quot;foo&quot;, namespaces = list(&quot;url&quot;))
  d$doc()
  # &lt;?xml version=&quot;1.0&quot;?&gt;
  # &lt;url:foo xmlns:url=&quot;&lt;dummy&gt;&quot;/&gt;
  </code></pre>