Check if wallet is encrypted or not through RPC API
From the source code (rpcprotocol.h):

RPC_WALLET_ERROR                = -4,  // Unspecified problem with wallet (key not found etc.)


So you could check for a JSON-RPC return value of -4, or if you want to be absolutely sure, you can use:

bitcoind [...] -help | grep walletlock


The walletlock RPC command becomes only available (in the -help list) after encrypting your wallet.