If a rent-a-car company accepts only credit cards, and among them, MasterCard is included, can I rent a car with a MasterCard debit card? Can they know at all whether cards with the MasterCard logo are a credit or debit card?
Many car rentals will accept a major debit card, basically those which are VISA or MasterCard. Some of those with the logo can be run as either credit or debit, and cards that are issued 'for electronic use only' would not be accepted. Yes, a merchant can tell whether the card is debit, credit, or both.
In the process of renting, the merchant will run your card and put a hold on your funds, so you need to have money sufficient for the entire amount of the rental. You may have a number of additional costs, such as extra insurance coverage and, in most cases, a large deposit (the amount can vary from 300€ to as much as 700€ ).
You can check in advance about the car rental company you plan to use, either on its web site, often in the FAQs, or by email. This Spanish site, for example, uses multiple suppliers, and notes that many accept debit cards, lists the ones which do, along with the additional requirements.