If you're lucky you can in often get by looking for xmlns attribute on the IQ or message child element and operate on the assumption that you know exactly what namespaces you expect to see a priori.
But yes, it's an uphill battle if you don't have a namespace aware XML parser.