"Visa believes merchants should not ask for ID as part of their
regular card acceptance procedures. Laws in several states also make it illegal for merchants to write a cardholder’s personal information, such as an address or phone number, on a sales receipt"
Unfortunately, the MasterCard and Visa Merchant Rules are often ignored by retailers. If you feel strongly about not showing identification as a condition of using your Visa or MasterCard credit card, you may wish to print out a copy of the relevant merchant rule (from the pdf links cited above) and ask to speak to a store manager.