This just happened to us at the Pemex station on Cozumel last week.
The attendant actually gave us a slip that said “ denied” on it. We then paid cash. Capitol One contacted us to ask if it was a good charge.
We contested it with Capitol One and learned never to use a card at a gas station.
Generally speaking, you should ask up front what the cost is for something ( price per gallon, cost of a taxi ride) ahead of time and agree on that price.