From what I understand, defining custom namespaces is perfectly valid XHTML
Nope. Custom namespaces are perfectly well-formed in XML, but ‘valid’ has the specific meaning that every element and attribute used is declared in the document's schema. That schema can be a DTD, an XML Schema, or something else, but you've got to declare it.
So you can declare your own schema to add custom attributes to the language, and indeed XHTML Modularization makes this very easy. You'd have to add the reference to the DTD as a <!DOCTYPE> in the prolog; just setting namespace URIs doesn't give an XML processor any hook to find the schema in itself.
But then what you've written is “valid my-language-which-is-a-bit-like-XHTML”, and not “valid XHTML”. Some of these ‘my-languages’ are well-known, like ‘XHTML+MathML+SVG’, but it's still not XHTML as such and if your client is dead set on “valid XHTML” you can't use any of them.
You've also got potential browser problems, particularly with IE, which (pre-IE8) does some weird things with the Element.*etAttribute* family of DOM calls. And unless you're actually serving the document as an XML Content-Type (which IE also can't handle), all of your namespace stuff isn't actually using namespaces anyway.
In [X]HTML5 there is a proposal to allow user custom attributes (primarily for scripting purposes) to go in attributes whose names start with ‘data-’. But in the meantime the usual method is to hide values in another attribute, for example class:
<div class="userid-123">...</div>
and then extract the data using suitable string processing over className in script.