Not Recommended
It is not recommended for hamsters to drink tap water. The main reasons are as follows:

Water Quality Issues
Tap water may contain chlorine, calcium and magnesium elements, as well as other chemical additives. These substances may irritate a hamster's digestive system, leading to diarrhea or other health problems.
Risk of Bacteria and Microorganisms
Tap water may contain microorganisms such as bacteria and parasites. If hamsters drink it for a long time, the risk of infection may increase, causing gastrointestinal disorders or urinary system diseases.
Long-Term Health Effects
Drinking tap water for a long time may increase the risk of urinary tract infections or kidney stones in hamsters, especially in areas where the content of calcium and magnesium elements is relatively high.
Safer Options
For the health of hamsters, it is recommended to provide the following water sources:
Boiled and Cooled Water: Boil the tap water and then let it cool down, which can remove chlorine and most of the bacteria.
Purified Water or Mineral Water: If possible, you can choose bottled purified water or mineral water. However, pay attention that the mineral content should not be too high.
Precautions
Change the Water Regularly: Replace the water with fresh water every day to prevent the growth of bacteria.
Clean the Water Dispenser: Regularly clean and disinfect the hamster's water dispenser to ensure hygiene.
In conclusion, although it won't be immediately fatal if hamsters drink tap water occasionally, for their long-term health, it is more advisable to provide them with boiled and cooled water or purified water to ensure the safety of their drinking water.