In the current situation, many people will have to cancel existing flight or hotel bookings, and would like to get a refund.
In which cases can one get a refund?
There are many specific rules which will vary based on at least:
But, in general, the following apply:
If your flight is cancelled by the airline, then you should in general be eligible for a refund.
For flights covered by the EU Flight Compensation Regulation EC261/2004, i.e. all flights departing from an EU/EEA member state or operated by an airline based in an EU/EEA member state, this is explicitly stated in Article 8 of the regulation.
Given that there are exceptional circumstances, no compensation is due. However, you must still be given the option of a refund, though one can accept rerouting or rebooking.
As airlines are cash-strapped, they will try to convince you to take a voucher instead of a refund. You can agree to it if you want, but they cannot force you to do so. Remember that many airlines will fail due to this situation. A failed airline cannot honour a voucher or a rebooking (though it's quite probable quite a few will fail before owed refunds are paid).
Airlines are required to refund you within 7 days. Given the very large number of queries they are receiving at this time, and the precarious financial situation they are in, it will probably take much longer, though, and in many cases any appeal will take enough time for the airline to have failed before you get paid.
For other cancelled flights not covered by EC261, the rule should be the same (they couldn't provide the service, so they should provide a refund), but this will be governed by local laws and/or the airlines terms & conditions (conditions of carriage).
Note that several other countries implement rules very similar (or even identical) to EC261, including Turkey, Georgia, Moldova, Serbia and Ukraine.
Note that you should only ask for the refund if you are at home. If you are stranded in a foreign country, getting a refund may complicate things a lot to secure alternate travel. Though EC261 requires the airline to provide both the refund and a return flight "at the earliest opportunity", in many cases the return flight you want may not be operated by the airline but via some other scheme.
If however your flight has not (yet) been cancelled, and you decide to change your plans, then you do not have the right to a full refund (unless the fare was fully refundable, of course). In theory, the original terms of your fare should apply (including fares being non-refundable, penalties, etc.). Most airlines will however offer to either rebook for free or provide a voucher valid for future travel (usually valid for a year). Note that in many cases, the rebooking options or voucher validity will be limited to one year from the original purchase date. I doubt any will offer a refund in this case.
This applies also if you change your plans because the situation at the destination is no longer suitable, or you will not be able to get to your hotel, or the conference or event you were planning to attend has been cancelled, or you are stuck in yet another country due to the current travel restrictions, etc. As long as it's not the airline cancelling the flight, no refunds are due.
The case of countries suddenly closing their borders to some categories of people (e.g. the US refusing entry to anyone having gone through the Schengen Area, UK, or Ireland in the past 14 days) probably falls in the last category: as long as the flight still operates, the airline usually is not required to provide a refund. However, if your country issues a travel warning, you may be entitled to a refund in some cases: for example, under German law, travellers who booked with a German provider may be entitled to a refund. See this question for details.
Airlines will often proactively suggest you rebook your travel or get a voucher. Once you have accepted that option, you are no longer eligible for a refund even if the flight you originally booked ends up being cancelled.
For hotels, the rules are basically the same, though I'm not aware of any blanket legislation like EC261:
If the hotel cancels the booking (because they will be closed or completely inaccessible), you should in general be eligible for a refund, even if the fare was non-refundable.
If the hotel is still able to honour your booking, but you just can't get there (because there are no flights, borders are closed, you're stuck in another country, region or city) or no longer want to get there (you no longer want to travel, the event you wanted to attend has been cancelled...), then you are in general not eligible for a refund.
Here again, the hotel may apply the original rules of the booking (no refunds or changes at all), or they can (and many will) allow for a rebooking at a later date or a voucher. But ultimately, that is their choice.
Travel booked as a "package" (flight + hotel, sometimes other components as well) sold by a travel agent or tour operator usually have additional protections, especially those sold by EU companies. Most importantly, if the flight is cancelled or the hotel at the destination is unreachable/closed, one is eligible for a refund of the whole package, whereas when both are booked separately, one may be able to get a refund for one but not the other.
Added 18/3/2020 In some places, the government has changed the rules, and explicitly authorises some actors to not refund, and instead only provide a voucher valid for one year. See this answer for Belgium for such an exemple.
Let's add that this is were travel insurance should come into play, but double-check any exclusions and conditions that may apply. Also, don't forget that you may have multiple travel insurances: many credit cards have a travel insurance automatically included for all travel bought using the card. Check the conditions and exclusions of any that may apply (you can of course only get refunded by a single one).