In answer to question "How does merged mining work?", we can read that in order to merged mine, we need to create a Bitcoin transaction containing a Namecoin block hash and put it on the tip of the merkle tree. Where can one find some guidelines or specification on how to create such a transaction?
I'd suggest looking at the merged mining spec at the bitcoin wiki.
When I was writing my merged mining implementation I also looked at the source code of namecoind, bitcoind and merged-mine-proxy.
As far as I know there is still no easier documentation on how to implement merged mining, so you will likely be looking through existing source code a lot to figure out the details. The merged mining spec was a big help for me though, even if it is a bit slim.