I'm not sure I understand your question, probably not.

If you need to transform a message and then apply/evaluate rules, then create two HL7 Routing Business Processes, each with a Routing Rule associated.

The first BP and associated rule transform the message and send it to the second BP where you can apply rules to the transformed message.

But....probably I did not understand the question! 😊

You already answered your question....in the question! 😊

From %SYS namespace, use the List class query in the Config.Namespaces class:

%SYS>Set ResultSet=##class(Config.Namespaces).ListFunc()
 
%SYS>Do ResultSet.%Display()
Namespace       Globals Routines        System Globals  System Routines LibraryTemp Storage
%ALL    %DEFAULTDB      %DEFAULTDB      IRISSYS IRISSYS IRISLIB IRISTEMP
%SYS    IRISSYS IRISSYS IRISSYS IRISSYS IRISLIB IRISTEMP
USER    USER    USER    IRISSYS IRISSYS IRISLIB IRISTEMP
 
5 Rows(s) Affected
%SYS>

 Or, if you prefer:

%SYS>Set statement=##class(%SQL.Statement).%New()
 
%SYS>Set status=statement.%PrepareClassQuery("Config.Namespaces","List")
 
%SYS>Set resultset=statement.%Execute()
 
%SYS>While resultset.%Next() {  Write resultset.%Get("Namespace"),$c(9),resultset.%Get("Globals"),$c(9),resultset.%Get("Routines"),!}
%ALL    %DEFAULTDB      %DEFAULTDB
%SYS    IRISSYS IRISSYS
USER    USER    USER
 
%SYS>

Maybe (likely!) I misunderstood your question.

What do you mean with "But some other namespaces on the same server could be mapped to a different namespace or even mapped to itself." ?

A namespace cannot be mapped to another namespace.

A namespace definition consists of default database for globals, default database for "routines" (all code) and optionally global/package/routine mappings to different databases. (Plus some default system mapping)

You mention you need to connect to Ensemble but your product version says IRIS. I assume you need to connect to IRIS.

In Windows you can install IRIS ODBC drivers and in Control Panel create a DSN to connect to a IRIS Namespace. Then in SSMS follow the instructions to connect to an external database using an ODBC DSN (I have no experience on this).
Make sure you use the correct 32 or 64 bits driver and DSN definitions (in Windows you can define 32 or 64 bits DSN), I'm not sure if Microsoft SQL Server Management Studio (SSMS) is 32 or 64 bits application, find that out first.

Another option is to use IRIS JDBC drivers, make sure you install the correct Java JRE for the JDBC drivers you are using.

Since this is windows, maybe ODBC is more convenient.

I'm not sure what "HL7 Reference Guide" exactly means for you, however, within "health enabled products" (IRIS for Health, Healthhare Connect, Healthshare UCR etc.) there are "HL7 Schemas" for all HL7 v2 variants up to 2.8.2.

Can be accessed from Management Portal Interoperability -> Interoperate -> HL7 v2.x -> HL7 v2.x Schema Structures.

There, for each version you can browse in detail the HL7 message structure, segments, field, subfields etc down to code tables associated to coded entries/fields.

If you don't have IRIS for Health, you can download IRIS for Health community edition that is free for non commercial/production use (check license for details).