What is the paranoid consumer to do? Well, there isn't much you can do to avoid this kind of fraud if the device you use has been compromised, but the same tips often spoken apply here. Only use well-lit, well-travelled ATMs and kiosks; if tamper-evident tape is used on the device, look to be sure it has not been tampered with; and walk away if something feels wrong.
These steps won't guarantee your card will never be swiped though. I do a few additional things to minimize the personal risk. First and foremost, I NEVER use a debit card or ATM card for purchases. Consumer protections laws (in the US at least) for debit cards are not nearly as strong as the same for credit cards, and a debit card is linked directly to a checking account. With a debit card, if a thief gets the number and my PIN, they have direct access to drain my account. With a credit card (paid in full every month! no sense in trading illegal scams for the perfectly legal trap of interest-laden revolving credit...), there is a degree of separation between purchase transactions and my bank account.
Additionally, I use Quicken financial management software (there are a few others that would work) that downloads transactions daily, so I know within a day or two of a fraudulent charge and can do something about it immediately, rather than finding out at the end of the month.
Bottom line: be smart and keep a healthy degree of paranoia about you.