Don't ignore attribute namespaces

would be really helpful to put in the comment here for why we want to do the check? My worry (might be unnecessary), that, if there is no "root" , then every time the code enters here, we will increase the prefixIndex one more time