How long does food stay fresh without being refrigerated?

It depends on the food. There are some foods that can last for a long time without refrigeration. Other foods can't last for more than a couple hours. For example, uncooked, dried beans or pasta will keep a year or more unrefrigerated. Foods that are normally refrigerated should never be allowed to sit at room temperature more than 2 hours. Moist foods, especially those with protein, provide a breeding ground for food-borne illness that can even be fatal. The general rule is that these foods should be kept below 40 degrees (in the refrigerator) or above 140 degrees (hot). If it's a food that you would normally refrigerate, please don't eat it if it's been at room temp more than 2 hours, maximum. (Just a reminder -- food can contain staph or other nasty bacteria even if it looks and smells fine.)

How soon food will spoil without refrigeration will depend on a variety of variables including: the ambient temperature, the type of food and the microbes present in the food.

Once the temperature of potentially hazardous food itself (like meat, milk, poultry, seafood, cooked beans, processed produce, etc) has gotten above 40°F for more than 2 hours, the food should be discarded. The food might not actually appear spoiled and there is the possibility that the food could be perfectly safe for longer than that, BUT foodborne pathogens and toxins don't make their presence known until many hours after the food has been consumed. The 2 hour guideline is conservative, but it would be better to discard the food than to suffer the consequences.