Hal Ruzal, a bike security expert, has a series of videos on YouTube, some of which are done in conjunction with the police.
In one he answers just this very question. His answer is not what you may think and does not match the current top answer here. He says it is much better to lock it in a quiet area. This is because the thieves are more edgy in terms of being seen or heard. In a busy area they are not noticed and the noises and things they do blend in with all else that is going on.
He has spoken to thieves and knows how they work / think. He often grades bikes based on how well they are locked. If you can keep your eye on it then that is a different matter of course. And of course it must be locked to something secure which may also determine where you lock it.
I would also add that locking it next to other bikes does not work as some answers suggest. As the thief blends in. You look and think he is just unlocking his bike next to yours - but he is after your bike! I once came out of an office where I locked my bike next to others to find a guy suddenly jump. I swore I saw him trying to unlock my bike and move away. He seemed to then pretend he was unlocking the bike next to mine! I was not sure so just left it as my lock and bike were not damaged. He may have been trying to pick the lock. But it shows how they blend in this way.