Good question, Jennifer.
The Labor Department's take on this is that you are perfectly allowed to discriminate if you can link your preference to a task that is part of the job. So, you can say "Only aliens from Jupiter" if you are looking for a writer/web designer/man-eating globbulax tamer where knowing about Jupiter was a critical part of the job. That would include, say, writing about politics on Jupiter or speaking Jupiteroxy or something like that.
I'm inclined to suspect "only candidates from the United States" is a job requirement that would be pretty hard to prove is absolutely necessary. I'm from the United States and I have to research almost anything I write even if it's about something that's happening on the next block,. On the other hand, a publisher could claim that our culture includes many finely-tuned nuances only someone from America could understand, like why Elvis Presley was such a gun freak and things like that.
To me "only U.S. residents" is clearly a way of discriminating, but I have looked at jobs postings from England that inludes "must know how to write for an English audience," as part of the qualifications. And, it turns out, there are many slightly puggled expressions those dafties know that would baffle most of us Yanks. So, it's hard to say. I think any barrister worth two guineas could make the case pretty easily ... leaving us morality bobbies in the bloody bench-hole, so to speak.
The short answer is yes.
There are a lot of different situations as to why a client may not want to hire someone from a specific location. One important one that comes to mind is that clients are often held to local hiring laws within their own country and so it's more difficult for them to legally hire freelancers outside of certain zones (such as the EU).
There's also the concept of hiring in a global market. While many clients are looking for freelancers that can provide good service for cheap and are willing to hire the best person for the job with the best offered rate, some may find it unethical to hire freelancers for significantly less than competitors located in the same area as the client.
I hope this helps and wish you all the luck in your job hunt.
Another aspect to this question is freelancers refusing to work with clients from certain countries. I do, but for purely economic reasons. I live in a country where the cost of living is high and I could not work for the rates that would be considered normal in some countries. Nothing to do with prejudice.