Manual:$wgNamespacesWithSubpages

Details
The variable holds an array indicating which namespaces allow sub-pages. The array is indexed by the numeric namespace ID, and each array value is either 0 (no sub-pages) or 1 (sub-pages allowed).

See Help:Subpages

Default value
The default is to enable subpages, but not within the 'main' namespace. They are enabled only within talk pages and user pages.

''Note: Enabling on all 'talk' pages actually requires many entries in this array; one for each talk namespace. Each version of MediaWiki only went as far as the maximum namespace existing at the time.''

Prior to 1.5.0
The NS_ constants weren't used (possibly because they weren't defined) so numeric values were used instead:

Namespaces numbers can go from -1 (The "Special:" namespace). Subpages cannot be enabled on namespace -2 (direct-linked media)

Enabling for a namespace
The normal way to enable subpages for a given namespace is to edit the  and insert the following:

This adds an item (a 'true' value) to the $wgNamespacesWithSubpages array which is already defined in

Enabling for all namespaces
This counts how much namespaces are within $wgNamespacesWithSubpages and sets them all to true.

Namespace names
The names for namespaces are set in files such as those listed in Locales for the Wikimedia projects, with default Language.php: