How do I spend Bitcoins from a specific address? What's happening when I use importprivkey? Are the coins merged to my existing private key or is the new key added to my wallet?

I want to import a private key, receive funds on it, and send the same coins using this key, not the others present in my wallet, is it possible with RPC commands? (for my website, I want the user to be able to see where his money is going by tracking the blockchain).
When you use importprivkey, the new private key is added to your wallet, giving you the ability to send coins received by a corresponding Bitcoin address. Your "balance" will also reflect this, including the coins accessible by this key in the total balance.

Bitcoind low level API gives you a pretty fine-grained control over your coins. Since there is no notion of a "source address" in the Bitcoin protocol, you have to specify the exact transaction and its output that you want to spend. Instead of using the common high-level RPC like sendtoaddress, you need to manually create a raw transaction, which comes in a few steps:


Prepare the transaction via createrawtransaction command, specifying outputs that you want to spend,
Sign the transaction using your imported private key via signrawtransaction,
Send it onto network using sendrawtransaction.


Be careful when using this API as Bitcoind does not protect you from making fatal mistakes, rendering your coins unspendable. Make sure you test your code on the testnet thoroughly before going live.