I'm posting to see if more advice comes. I work in a very open-door environment now and get pretty much no work done at all. It's even worse because my office is right by the door. The department where I just interviewed is also very open-door with the expectation of chatting with students, etc. My only hope would be to do most of my real work at home, or to end up with an office on the 2nd or 3rd floors.
Well, this is not so good. Can you set your desk up so that you are NOT facing the door---so that, visually, if someone does transgress and pop in, it is more obviously an interruption? Try this with door mostly closed, back to door, and gradually close it more and more?
I do think headphones work, even if you have only silence coming through them into your ears. When you are at your computer, engrossed in whatever you're doing, with headphones on, even a really doltish extroverted colleague can SEE that you ARE WORKING. The trick is not to look up at the first or even the second interrupting sound. Just stay steadily focused. If someone actually does barge in, and you are still writing, looking down at the work, they will have to break your line of sight or physically touch you to get your attention. Then you can seem startled, say, "oh my goodness, I was concentrating on this work! Didn't see you! What can I do for you?" In a pleasant way of course. This forces them to make an obvious interruption, and they are less likely to do this than if you are always looking up and smiling out your doorway at passersby.
If they have come all the way in in to your office, you can chat briefly, then get up as you are talking, continuing the conversation, walk them OUT of your office, and maybe even down the hall, as you "take a bathroom break." Then you can go back in and close the door. This works for the really persistently chatty and clueless colleagues.
I also have a private hypothesis about conversational need. Colleagues are kind of like dogs in the park: they need to check you out (thank goodness this doesn't involve crotch sniffing, at least with most colleagues, hehh). And like dogs, they need to check you out repeatedly. On every monday morning, there is lots of chatty conversation; if you just think of it as their weekly re-check, sniff sniff sniff, and you wag wag wag, then you're ok, you're part of the gang, and you can get back to work. You kind of have to give them their conversational fill, their greeting and chat rituals, and some need this more than others. If you can get it over with all at once it is better; and then get into your office and put door ajar.
On these fora I think I recall someone who had a cute sign for the door, one side said something like "Working Hard---Please come back later!" and the other side said "Taking a break---Come on in!" I don't recall but you could have little illustrations, if you draw, of a person buried under deskpile, leaning over work with sweat droplets emanating outward, and on the other side, a smiling person kicking back with java and clean desk...this might have been a colleague in another department at my old place... anyway, it's an idea.
New people have to be checked out by the pack, though, and there is no way around it; esp when untenured you have to put up with this. But after a reasonable, pleasant chat, there is no reason not to glance at your watch (do this while yOU are talking, not while the other person is talking) interrupt YOURSELF (not them) and say "Oh my, I've lost track of the time, it's been great chatting, but I've got to grade those papers! (or whatever the most-approved activity is in your dept's culture---an article deadline! a lab to prepare! a conference talk to wrote! an assessment committee rubric!). Smile and scurry back with a "see you tomorrow!" (not see you later, which allows them to think it's ok to come back later). And put on the headphones. And be inside your Cone of Unbreakable Concentration.
Good luck--it is a problem, no doubt. In my old job it was horrible; here, there is an unspoken taboo: if someone's door is closed, you do NOT knock, disturb them, etc---colleagues will say, "Oh, Joe's door is closed, let's email him and ask." If the door is open, we go on over and knock at the frame, or call out greetings as we pass, but a closed door is a clear signal around here. This is one of the many things I love about this new(ish) job.