targetNamespace and xmlns without prefix, what is the difference?
For those who are still confused, consider these three xsds. They all define one global type and one global element definition that references it.
First, an xsd like the one posted above. It uses the prefix 'xsd' for the schema namespace, and a default namespace for the targetNamespace:
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/"
xmlns="http://example.com/">
<xsd:element name="aGlobalElement" type="aGlobalType"/>
<xsd:simpleType name="aGlobalType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:schema>
Now the same xsd, but defining and using a namespace prefix for the target namespace:
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/"
xmlns:tns="http://example.com/">
<xsd:element name="aGlobalElement" type="tns:aGlobalType"/>
<xsd:simpleType name="aGlobalType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:schema>
...and finally, a version that uses a default namespace instead of 'xsd' for the XML schema namespace:
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/"
xmlns:tns="http://example.com/">
<element name="aGlobalElement" type="tns:aGlobalType"/>
<simpleType name="aGlobalType">
<restriction base="string"/>
</simpleType>
</schema>
Most of the schema authors choose the first or the last, because if the default namespace facility is available then we might as well use it for something.
targetNamespace is an XML Schema "artifact"; its purpose: to indicate what particular XML namespace the schema file describes.
xmlns - because the XML Schema is an XML document, it is then possible to define a default XML namespace for the XML file itself (this is what xmlns attribute does); the implications are multiple: authoring, and composition. For example, one does not have to use a prefix for the items defined in the schema, that are later on referenced elsewhere in the same file (e.g. a global simpleType used as a type for an attribute or element).
From my experience, many XML Schema authors consider this as a "best practice"... so you're on the right track.
In terms of XSD, the targetNamespace prescribes the namespace part of a qualified name of a schema component, which includes elements, attributes, groups and attribute groups, and simple and complex types. Some of the qualified names defined in an XSD (elements and attributes) are "directly" used by an XML instance document. Others, such as for types, can be referenced through the xsi:type attribute in instance XML documents. The rest (groups, attribute groups) are there to facilitate schema composition (through references).
I'm also of opinion that (in general) people come at designing XSD from two angles:
to match an existing XML. In this case, if your XML uses namespaces, for each of the namespaces used, you'll end up with an XSD schema element with a matching targetNamespace attribute.
pure modeling. You then think of targetNamespace similar to an UML package, or database schema, or a Java package, or a .NET namespace, and all it means in this case. Fundamentally it is a mechanism to avoid naming collisions; nonetheless, it is also a mechanism to partition models in subject areas, etc.