Ensure namespaceURI is not undefined; fixes #5