How not white?
It needs to be visibly distinct. When looking at the ad on a page, the reader should see a very obvious box-shaped thing so that it's very clear "This is an ad, it is not part of the underlying site design". Everything borderless in the sidebar - question stats, related questions, they all are a direct element of the site. So stuff that isn't that stuff, especially stuff that is traditionally linking off-site, needs to distinctly look like such.
There's no exact threshold - just pick something that isn't, well, light and distinctly a non-white color.
The above is the sample ad we use. That's pretty light background, but there's a faint border of not nearly as light around it. That makes it look like a box, and that's the kind of effect we need. That's still a fairly light-ish color on the border, but it's still dark enough. Try working off of that.
Is transparent okay?
Nope. See above - the point is to avoid looking like it's an on-site element. If your image is basically on a transparent block, that's going to be equivalent to a white block.
For the I'm not going to write all that
I'm not a master of knowing exactly how these compress when resized to know for sure whether a 1px will end up as a 1px, a 0px, or only 1px on 2 of 4 sides. So to make sure it works out, I'm going to say it's best to stay on the safe side and go with a 2px border. I'll update the border requirement while I go and update the text to say "High DPI" instead of "Retina" later.