Is there a way to get a list of the namespaces declared/used?

I am wanting to right a function that does a function lookup, but I want to right it in such a way that I don't have to know the namespaces ahead of time.

Are there any functions that will return a list of the namespaces being used?

Thanks in advance,

Buddy