To add new brand xml namespace use:
<?php
$element->setAttributeNS(
'http://www.w3.org/2000/xmlns/', // xmlns namespace URI
'xmlns:mynamespace',
'example.com/mynamespace'
);
?>
'http://www.w3.org/2000/xmlns/' URI is important
to be able to add new namespaces !!!
Later you can use your namespace like:
<?php
$element->setAttributeNS(
'example.com/mynamespace',
'mynamespace:something',
'value'
);
?>