Problem
In T200938 it was discovered that there was a need to determine what the canonical namespace is for a given namespace index from a foreign wiki or tool (something that has access to the database, but not the config). However, there is no way to do that.
Likewise, there is no way to ensure that a namespace id doesn't represent two different namespaces on different wikis.
It is impossible to get a full name (and url?) of a page without using the API.
Solution
Register namespaces in the database with a namespace table. This table would be an id and a canonical name. This would give something for page.page_namespace to relate to in queries.