You can use typeof...
Code:
if(typeof myVar == "undefined"){
// variable is undefined, do something
}
However typeof will return "undefined" if a variable has not been set to any value / object / etc., so var myVar; would return "undefined" and var myVar = null; would not.
HTH,
Chris