I am not pretty sure about it, but a teacher once told me : we usually use 'a' when the locations are maschile : bagno,letto,mercato ...and all cities (all cities are maschile) and use 'in' when refers to luogo femminile :discoteca banca biblioteca mantagna ..and countries. However there are lots of exceptions ....