I used to have this problem all the time. Then I found out that my money clip has a magnet in it.
Now my son (who works the front desk at a major hotel) says that he thinks that the strip on credit cards may cause the keycard to stop working. I don't think he's right though. Since I found out about the moneyt clip I keep my hotel keys in my wallet next to my credit cards. I haven't had a problem in years. BUT the kid says it happens all the time and he's sticking to his story. I think he's nuts.
Just my 2.5 cents