I guess when you are with KK and AA on drawless board with lower cards, you can't help it.. If you run into a set, you hope for your two outs ♦
In any other case, the set is still a tough obstacle, because it is easily hidden hand and you can get a read quite rarely. I guess the key is to take care with hands like high aces(top pair with good kicker for example) and to try and control the pot with them, you don't want it to get huge... Fold when check-raised big. I guess raise on flop and check on turn is often an indication of a set or any other huge hand.
It's definitely hard and I still lose much against sets, too, but underestimating hands like AQ or AJ and avoiding big pots with them even if you hit a pair surely helps to minimize the losses.