Photo by Jannes Pockele
There are a lot of foods that are fine for people but that can be toxic to hamsters causing diarrhea and other health problems up to severe poisoning and death. Please make sure you never give your hamster any of the foods mentioned below. Apart from that, the general rule is to never feed your pet anything too sugary, salty or spicy, including fried foods and alcohol.

Note:
The following list is not exhaustive. It represents only the most common foods dangerous for hamsters. If you're not sure whether this or that food is safe, we recommend that you refrain from giving it to your hamster. It's better to be safe than sorry.

Almonds
Apple Seeds
Avocado
Cabbage*
Celery**
Chocolate, candy, and other sweets
Citrus fruits (lemon, orange, tangerine, grapefruit, etc.)
Dried fruits
Eggplant
Food Additives
Fruit Pips
Garlic
Grapes & Raisins***
Iceberg Lettuce
Junk food designed for humans (chips, pizza, chocolate, etc)
Kidney* or red beans
Mushrooms
Milk
Onions
Peppers
Parsley
Pickles
Potato*
Red meat
Rhubarb
Tomatoes (leaves and stems)
Vitamins

*Whether these foods are safe or toxic is still under debate. Cabbage, cooked potato and cooked kidney beans (both served cold) may be fine for your hamster in small amounts. However, we've added them to the list to be on the safe side.

**Although celery is not generally considered toxic, it is very high in Sodium. Too much Sodium can increase the retention of water in the body tissues, so it is not generally recommended to feed celery to your hamster.

***Even though many people say it's okay to give a hamster seedless grapes and raisins, this fruit has been known to cause acute and chronic renal failure (kidney failure). It is advised that raisins and grapes should not be fed to any animal until more research has been done.
See also:

Feeding a hamster

Dangerous Foods for Dogs

Dangerous Foods For Cats

Top 5 Toxic Foods For Cats and Dogs