Hi Hans-Jürgen,
basex "<foo>{namespace {''}{'bar'}}</foo>" => [XQDY0102] Duplicate namespace declaration: ''.
This is expected. The specification states that “[…] if the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error [err:XQDY0102]”
You’ll need to include a (static) namespace URI as part of the direct element constructor:
<foo xmlns='bar'/>
Best, Christian
[1] https://www.w3.org/TR/xquery-31/#id-ns-nodes-on-elements