added Check function to check for undeclared namespace prefixes
cache the in-scope namespace set
flip order of copyScope parameters