not sure if we could express this with a query. I'll have to give it a try.
Just wanted to suggest an alternative. Did you try to use the "Immediate Dominators" query? You can call it for example from the context menu in the class histogram, on the class you are interested in.
There you can specify dominators of which types should be excluded. This doesn't really remove them, but for dominators matching the pattern the next dominator up in the hirarchy would be shown.
For example if you have
MyObjectA -> HashMap -> HashMap$Entry -> HashMap$Entry -> MyObjectB
and if you run the immediate dominators on MyObjectB with the default skip pattern (e.g. java.* ...), then you'll see that MyObjectB is dominated by MyObjectA
If you do this on a set of objects, you get the result aggregated per class.
Let me know if this could be used as a workaround.