I have been in many more discussions on this topic than almost anything else music related. Some people agree whole heartedly, while others violently oppose this line of thought. I for one stick by this rule for EDM DJs and performing producers. One of the arguments people have against my view is that if live bands can pre plan their song list at a concert, what is the difference? My response is that bands are not just standing there hitting play, or standing there mixing 2 pre-recorded songs together. Watching a DJ is way more boring than watching a band shred live on stage.
It is also in a DJs job description to read a crowd and diversify based on the crowd's reaction and body language. Maybe if you were playing to 20,000 people, it wouldn't be as big of a deal, but in a crowd of a few hundred, it makes a huge difference. The reason I say that in a large crowd it may be ok is because fucking up in front of 20,000 people could ruin your image for one thing, and another thing is that out of 20,000 people, it is highly unlikely that you would drop a song that would clear the dance floor. In a massive event, most people will go ape shit no matter what you play.
The smaller shows, say under 1,000, are where your crowd reading skills should really come into play. It is much easier to notice that no one is dancing, or people went out to smoke while you are playing in a smaller crowd. You are right in front of their face. You can see the broccoli in their teeth and can high five them. Basically you are in an intimate environment and you need to play to them.
What you practiced all week in your bedroom may not work for a live audience, and every audience is different. Every city is different. People act differently based on the weather, time of year, who played before you and set a certain mood, who or what is playing in the other room at the same time, if it's a campout or in a club, day time or night time, or just the general vibe of the event. Who knows what will effect what people are into at a certain time, but the fact of the matter is that you need to have a diverse library, or be a diverse producer, so you can match what they are feeling or else you will not connect with them. Your set could sound amazing, but people might think your set sucked, just because it didn't match the tone.
Some DJs say, "Fuck them, I'm the DJ and they need to listen to what I want to play", but then they get all butt hurt when their dance floor dies after their first few songs. DJs, I can't stress this enough, you need to be looking up and around constantly and analyzing your audience. Comedians do it all the time.
As I said before, I have had many debates on this, so you may have your own opinion, but I feel that if you are confident and skilled enough, this should be common knowledge to you, and not a hard task to achieve.