Do you mean generate a new address, or get a private key from a address already in the wallet?
generate a new address in the default account wallet is on the command line
if on unix
bitcoind getnewaddress ""
to get the private key of a address
bitcoind listaddressgroupings
Find the address you are looking for in the list and copy it.
bitcoind dumpprivkey <paste the copied address here>
You can do the same in the debug window in bitcoin-qt