I don’t see that you set the parser to be namespace-aware so that’s most probably the missing thing here.
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(inputStream);
Then invoking getLocalName() on a node will give you the name without any prefix.
However if that’s not enough for you and you really want to get rid of the name-spaces at all you can use an XML transformation to create a new DOM tree without the name-spaces:
Transformer trans = TransformerFactory.newInstance().newTransformer(
new StreamSource(new StringReader("<?xml version='1.0'?>"
+"<stylesheet xmlns='http://www.w3.org/1999/XSL/Transform' version='1.0'>"
+ "<template match='*' priority='1'>"
+ "<element name='{local-name()}'><apply-templates select='@*|node()'/></element>"
+ "</template>"
+ "<template match='@*' priority='0'>"
+ "<attribute name='{local-name()}'><value-of select='.'/></attribute>"
+ "</template>"
+ "<template match='node()' priority='-1'>"
+ "<copy><apply-templates select='@*|node()'/></copy>"
+ "</template>"
+"</stylesheet>")));
DOMResult result=new DOMResult();
trans.transform(new DOMSource(document), result);
document=(Document)result.getNode();