Output an xmlns attribute on namespace changes

Whenever the namespace of an element does not match the namespace of its
parent (or when it doesn't have a parent from which to inherit a
namespace), an xmlns attribute must be output to declare the namespace
of the element.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>