How to tell which account an unspent output is in? When I go to send coins, I want the transaction to ignore the unspent coins in a certain account.

I think I can do this in wallet.cpp, but I'm not sure how.

Maybe in the AvailableCoins() function? Make it continue if the coins are in this account? I guess I need to create a function like:

bool isInAccount(string strAccountName, CWalletTx *wtx)


How can I go about doing this?
Your question is based on a misunderstanding of the account system. It's a very common misunderstanding, though.

Unspent outputs are not associated with accounts.

Incoming transactions credit the balance of the account associated with the address the transaction is received with. But accounts only have a balance - they don't 'own' the coins sent to them. Account balances can go negative, and can be modified through the move command, without changing the coins.

The unspent outputs belong to the wallet as a whole, and accounts just keep track of who/what owns which amount of them - not which ones specifically. It is like keeping a wallet around with money that both belongs to you and to a friend. You keep track of how much you owe your friend, but you don't keep track of which specific notes or coins in the wallet belong to them.

To do what you want, you either need to use separate wallets (which keep the coins separately entirely), or use coin control or the raw transaction API, which allow you to specify manually which coins to use.