What are some common pitfalls when working with namespaces in XML files when using PHP?

One common pitfall when working with namespaces in XML files using PHP is not properly registering the namespaces before querying or manipulating the XML data. To solve this, make sure to register the namespaces using the `registerXPathNamespace` method before performing any operations on the XML data.

$xml = new SimpleXMLElement($xmlString);

// Register namespaces
$xml->registerXPathNamespace('ns', 'http://www.example.com/ns');

// Query XML data using namespaces
$nodes = $xml->xpath('//ns:node');