I can't tell what goes wrong with that stylesheet sample alone. Post enough information allowing us to reproduce the problem (i.e. input sample, XSLT processor version). Usually the problem occurs when people want to output XHTML for instance and then do it like this
Code:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="foo">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
</xsl:stylesheet>
as that way the "p" elements are created in no namespace inside of a "body" elements in the XHTML namespace and then the output has <p xmlns="">...</p> to ensure the "p" elements are output in no namespace. Moving the xmlns="http://www.w3.org/1999/xhtml" to the stylesheet root fixes that problem.
I don't see anything like that in your stylesheet sample so I am not sure why you get the xmlns="" in your output.