As long as it's a plastic key card, you should be fine keeping the card as a souvenir. The cards are re-coded after each stay and they are very inexpensive for the hotel to replace. If you're staying somewhere with an actual key, please ask in advance.