Upon arrival at Barajas Airport in Madrid, we went to the taxi queue at the curb, and assumed we got into a licensed cab. We asked how much the fare would be, and were told 29 euros. The meter was turned around and hanging by a wire, non-functional. We should have said something, but our luggage was already in the trunk. Upon arrival at the hotel, the driver swiped our credit card about 3 times and told us it did not work. I then made a comment about the broken meter, and we were then told the price would be 24 euros, which I paid in cash, but did not ask for a receipt. When my credit card bill came, there was a charge for the cab, so the driver charged us twice. Fortunately, the credit card company took me at my word that I paid cash, and reversed the charge. I was told this scam is pulled frequently. Be sure to ask for a receipt regardless of how you pay.
There are categories of people that I instinctively distrust no matter where in the world I am. One is used cars dealers, the others is taxi drivers. They are the ones that ripped me off (or tried to) most often. Also always inquire online into the common charge for a certain route before you board on one. I also try to avoid using credit cards with any people I tend to distrust.
In Madrid I use Aero City Van. You pay at the booth and the van (shared) takes you right to your hotel. It's cheaper than a taxi and there is no way they can overcharge you.
"We should have said something, but our luggage was already in the trunk."
I just ran into this problem in Israel. Everyone says you should "make the driver use the meter or get out if they won't," but that's hard to do when they have your luggage in their trunk, and they claim not to speak English. That was the first and last cab I took in the country.
I never pay the cab with credit card and I never pay until I and my luggage are on the curb. I have on occasion handed the correct amount and told the driver to call the police if he is not satisfied when they tried to scam me. But make sure you have your luggage before challenging the fee.
That said, we have almost always had honest cab drivers and once in Rome I had one actually point out I had bungled the money and given him too much. The worst experience we had was in Hong Kong -- but I actually had the sheet of paper given to people at the airport with the cab costs and rules so I was in a position to pay what I actually owed and not get scammed.