My tots will usually let me work for an hour or two at a time. They know that if they cross a certain line, I'll restrict their activity, and they are pretty well-disciplined most of the time. When they were younger, I routinely put them in their "pen" to play for an hour at a time, but now (since about age 1.5), they do fine having free range in the house or in the backyard (with me working at a window where I can see them). They will get quiet and say "shh" when someone is on the phone and are pretty good about respecting work equipment / papers and such. I still have to keep one ear focused on them, but I can get work done.
I'm not really sure whether I did anything to bring about their cooperativeness. They have always been fairly calm and aware of rules. I am pretty consistent about enforcing the rules - a repeat offense results in having to "sit" for progressive periods of time; fighting over a toy results in the toy being taken from both; stuff like that. Another thing I do is communicate clearly about what I expect, and what they can expect (e.g., I need to sit here for x minutes and you need to play outside, then we will do y), and follow through on what I say.