A student of mine once said that he was sick of Stephen King's books because he was "tired of reading about people in Maine." "He needs to find new places to write about," he said. "All of his stories are either set in Maine or Colorado."
The reason, of course, is simple; King lives in Maine, and has spent a lot of time in Colorado. He writes about them because those are the places he knows the best. The same could be said about most writers, honestly. Most of my stories are set in upstate New York, southern Louisiana, or the Pacific Northwest -- all places I've lived for at least ten years each.
It's an interesting question whether a fiction writer can write convincingly about a place (s)he's never lived, or (even worse) never been. My general sense is "no." I tried that once, back in my cocky, I-can-get-away-with-it days, and set part of a story in Ireland -- a country I've still (unfortunately) never visited. I finished the story, but it never set well with me, and ultimately I destroyed the manuscript (which will no doubt frustrate my future biographer). It just didn't ring true.
The whole episode reminds me of the anecdote about Mark Twain, whose penchant for swearing was legendary. His wife, trying to shock him into reforming his ripe vocabulary, one day went on a five-minute rant, using every obscene word and vulgarity she'd heard her husband use. After a moment's stunned silence, Twain commented, "My dear, you've got the words, but you just don't have the music."
That's the problem about writing about a place you don't know; you can do your research, and get the words, but you still won't have the music. That takes spending some time there, it takes an intimacy with the setting. It takes gaining a sense of place. The little things are what are important here; the strange little turns of phrase characteristic of the locals, the oddities of behavior that everyone there takes for granted, the features of the landscape that show up on no map. I think you'd have to live in a little village in upstate New York, for example, to learn that on Sundays in June there are dozens of outdoor chicken barbecues where you can buy lunch, John Deere rider lawn mowers are de rigueur even if you have a small lawn, and only people in "big cities like Ithaca" ever lock their doors. And very few people outside of southern Louisiana know that "howzyamommandem?" is an expected greeting (and yes, it is one word).
It may be easier to get away with writing about a place you don't know well if you set the story in the past, because the distance in time automatically engenders an unfamiliarity in setting. I've only written three stories (that have survived) set in places I haven't lived, one in Iceland (Kári the Lucky) and two in England (We All Fall Down and Adam's Fall). In my own defense, I have visited both places and studied their history fairly extensively, but still, it's no coincidence that all three stories are set in the past -- in the 11th, 14th, and 18th centuries, respectively. (Whether I "got away with it" or not I'll leave the reader to decide.)
I think that the most successful stories are the ones which envelop the reader in a setting that feels real -- in which you are experiencing first hand the sights and sounds of a place almost as if you were there. Whether a talented writer could do that by sheer academic research, without visiting a place, I question. For myself, I'm more comfortable writing what I know. It feels like I'm home.