Yes, you can use *[local-name() = 'fred'] to match an element with a local name of "fred" regardless of its namespace.
Within that match, I need to create an element whose local name should
be location.
Here, your question becomes a bit unclear. The namespace (or lack of namespace) of an element you create in an output document is up to you; it needn't have any tie to the input document. If it should in some way be tied to a namespace found in the input document, you have to say from which part of the input document the namespace should come.
Update per OP comment below:
I want to use the namespace of parent fred element, whatever it may
be, or if it is null/empty.
Ah, ok, this example may help then. Given this XML input document
<root xmlns="http://www.example.com">
<fred/>
</root>
the following XSLT
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/*[local-name() = 'root']/*[local-name() = 'fred']">
<xsl:element name="location"
namespace="{namespace-uri()}"/>
</xsl:template>
</xsl:stylesheet>
will produce this output XML
<?xml version="1.0" encoding="UTF-8"?>
<location xmlns="http://www.example.com"/>
which uses the namespace of the fred element from the input XML.
And when given this XML input document
<root>
<fred/>
</root>
will produce this output XML
<?xml version="1.0" encoding="UTF-8"?>
<location/>
where location is in no namespace.
<xsl:element>controls the output, it has nothing to do with matching the input. Is there a difference in the required output if the matched node is in a namespace or if it isn't?