It provides no damage resistance and is purely a cosmetic item - however, it is counted as a piece of lower headwear, which allows the user to equip any sort of upper headwear at the same time. It can be equipped by Dogmeat.
The house closest to the Red Rocket truck stop. Upstairs is a dresser guaranteed to contain a welding goggles and a red bandana that adds one more every time the cell loads.
A blue one can be found on the corpse of a scavenger right outside the Harbormaster hotel.
A Jangles bandana can be found under a Pack rad gorilla chair in Nuka-Town backstage.
Gunner's bandanas and skull bandanas can be found anywhere that low-level Gunners are present. It is a common cosmetic item that is worn frequently, and is usually dropped when they are killed.
Stars and Stripes bandana can be found inside Monsignor Plaza, on a shelf behind the counter of the clothing store, located on the first floor.
Notes
All bandanas are equippable on both NPCs and dogs as a cosmetic item.