I notice that if you have the door to your office closed, you get more work done today and tomorrow, and you are more productive than most. But 10 years later somehow you don't know quite know what problems are worth working on … He who works with the door open gets all kinds of interruptions, but he also occasionally gets clues as to what the world is and what might be important. … [T]here is a pretty good correlation between those who work with the doors open and those who ultimately do important things, although people who work with doors closed often work harder. Source: Richard Hamming, "You and Your Research"
And Sridatta Thatipamala’s take on it…
[P]roducing brilliant work is heavily reliant on serendipity. Putting your nose to the grindstone will certainly get things done, but when you are working on cutting-edge problems with no predetermined path to success you derive inspiration through chance discoveries. Both these men were probably relied on conversations with their brilliant colleagues to deliver them random insights. But they also had the advantage of working at the top of their games at Caltech  and Bell Labs, respectively. The common geek today relies on the Internet, especially community watering holes like HackerNews and Reddit, to keep abreast of "what the world is and what might be important".
And me? I think finding a balance between locking yourself in a room without distraction and immersing yourself in serendipitous discovery is a lifelong balancing act for creative people.
I don’t always get the balance right, but I think I’ve gotten pretty close over the last year. In any given week, I’ll typically spend about two days ignoring everything around me and grinding out work - coding and what not. I’ll only check my email in the morning and after work, and basically shut out all distractions.
I’ll spend another day very heavily interacting with everyone I can. Talking to work colleagues about projects, concerns, needs and so on. Exploring the internet for cool, interesting new things. Pure discovery.
Those remaining two days are kind of a grab bag. I may spend an hour or three doing research. An hour connecting with people. A few hours doing work. They’re more fluid.
It’s not a perfect system, but it’s been working pretty well for me over the last few weeks.