The chances of flopping a set a little better than 8:1 against you flopping it. You never know your exact equity so we can settle on 8:1 for the purposes of figuring out when you should be calling with a pair pre-flop.
As others have said, I'd recommend always open raising your pocket pairs, not only do you gain some pre-flop initiative but you also disguise the strength of your hand somewhat ( you could have AA KK, or JK or 22) if you limp you are virtually telling everyone you have a small pocket pair.
So using the 8:1 against math, we know that every 9 times you call preflop with a pocket pair, on average you will flop a set just once. Eight times you will not improve your holding on the flop.
However you will not always get paid off when you hit your set so you need to to call tighter than simply looking to get it in with effective stacks of 8x the bet you called. If you are playing a weak player, and are reasonably confident they have a fairly good hand (they are raising from EP, and are tighter from EP than LP) then you can call with about 12:1 odds I would say.
If you are out of position, you might want to increase this however as your chances of getting stacks in by the river diminish even more. If you are playing a very good player that can fold AA to post flop agression, and read your hand, you will want to play with more even greater implied odds to compensate for the times you hit it and don't win any extra money.
Finally I would make sure the effective stack is always 100bb deep (or very close to).
So as a rule of thumb I'd say always make sure you have 12:1 implied odds. But also increase this depending on the strength of your opponent, the likely strength or weakness of their holding, and your position.
Good luck!