How can commercial cold brew coffees and other lattes stay unrefrigerated?
With preservatives. Also if you look at the ingredients in any shelf stable coffee beverage that has dairy in it it will say does not contain milk.
Pasteurized food and canning allows no bacteria to breed in a canned or bottled food product. The same techniques used to can vegetables and fruit make it possible to have shelf-stable beverages.