Have a look here:
Especially on anlysing the elements and its corresponding namespaces by using the …Descendants()(index) option within the immediate panel
here we would, depending on the analysis result, also construct a XNamespace variable and use it.
BTW: there are also techniques where we can grab all namespace variables dynamic and store it within a lookup dictionary. This LookUp Dictionary we use later for the retrieval