Can a person take a plastic bag and put it on his hat on a rainy day on shabbos?
In the public domain, this would not be permitted. A plastic bag is not part of the hat, and just placing it over the hat doesn’t make it into an integral part of the garment. Because it is not derech malbush, a “way of dressing,” it is forbidden to wear it in the public domain (without an eruv).
Even with regard to specially made nylon covers for hats, some are stringent, due to the concern that the wearer will take it off (Minchas Yitzchak (3:26). However, most are lenient (see Shulchan Shlomo, 301:11; Shevet Halevi 1:61). According to Shemiras Shabbos Kehilchasa, it should not be worn in a full reshus harabim.