Providing a namespace via the xmlns
pseudo-attribute changes the default element namespace in the nested XQuery scope. You can get around this by using namespace prefixes,
declare namespace ns = "http://www.blah.org";
let $xml := <wrapper><elem>textIWant</elem></wrapper>
return <ns:newElem>{ $xml/elem/text() }</ns:newElem>
or using the "any namespace" XPath syntax:
$xml/*:elem/text()