From memory, when I am not playing well, any of the following have discouraged me:
Lightning fast greens (Oakmont)
Heavy rough (any number of places, including Merion)
Water (Doral and many Florida courses with lakes on nearly every hole, sometimes on both holes)
70 bunkers or more (most recently La Costa, but many Dick Wilson, Joe Lee or RTJ course, with some Pete Dye courses counting as well. I normally hit 0-2 bunkers a round, but when every LZ and green has 3-5 bunkers, you are just going to hit that many more.)
Oddly, I can't recall any heavily treed courses ruining my fun. I am normally pretty straight.
In general, those courses with hazards everywhere are just going to beat the average golfer up. Rough seems to be the absolute worst to me. But, in playing couples golf at La Costa last week, the pure number of sand bunkers affected the wives.
Basically, any tough hazards, liberally employed, can make the day miserable.