How does one mine Namecoins? In order to mine Bitcoins, one needs to start the bitcoind with "-server" flag and later request from it a getwork to solve. Does the Namecoin client operate in the same way, or is there some specific "namecoind" version one needs to use in order to generate coins? Where can one find the communication protocol for it?
The -gen flag actually started a CPU miner process in older versions of the Bitcoin client, before CPU mining became obsolete.

What you're probably thinking was more like bitcoind -server or `bitcoind -server -RPCALLOWIP=192.168.1.* -RPCPORT=8333 which would start a listening Bitcoin server from which a proper miner could obtain getworks. Since namecoind is a direct port of bitcoind with only the DNS-replacement functionality added, the flags are the same. Nothing special or fancy required, just follow any old "how to solo mine" tutorial and replace bitcoind with namecoind.