Text from specification
The namespace prefix, unless it is xml or
xmlns, must have been declared in a namespace
declaration attribute in either the start-tag of the element where
the prefix is used or in an ancestor element (i.e., an element in
whose content the prefixed markup occurs). The prefix
xml is by definition bound to the namespace name
http://www.w3.org/XML/1998/namespace. The prefix
xmlns is used only for namespace bindings and is
not itself bound to any namespace name.
Explanation
You have to declare all namespaces before you can use them. The
prefixes have no meaning without the declarations, so using a prefix
without a declaration context is an error. The namespace with the
prefix xml is permanently defined, so there is no
need to redeclare it. The xmlns prefix used by
namespace declarations is not considered a namespace prefix itself,
and no declaration is needed for it.