One of the biggest challenges of running a sandbox campaign is that the referee is simulating a world. More precisely the area of the world where the character happens to be at. While this is true of other styles of running an RPG, with a sandbox campaign there is little control over where the PC goes next. With experience, you can get pretty good at predicting where the next session is going and prepare accordingly. But in the end, you never have enough prepared. There is never enough details. There will come a time where you have to make locales and NPCs out of whole cloth on the spot.
The way to overcome this is with your bag of stuff. Everything that you played, read, experienced, or watched about fantasy, storytelling, places, and people are in your bag of stuff. While running a roleplaying session you are drawing on this to create the world in front of the players.
While this is done in all play styles, you will be called to do it more often with greater scope in a sandbox campaign. You may have to come up with a whole town within a couple of minutes while the players are travelling . A noble house, a dwarven hold, a orc warren, a merchant and his caravan; the list is endless.
Many referee are intimidated by this. The key to overcoming this is systematically thinking about what you know and developing tools to help plug the gaps.
What is your mind eye's view of a fantasy town, populate it in your head, now make another version in your mind. What different? What the same? Thinking through the various common situations in a campaign you will find that you have elements that you use over and over again. Once you identify these elements you can organize them in a sort of random table in your head. Use that to come up with with new and interesting locales, people, and situations on the fly.
The three broad areas are places, people, and situations. Places can be a settlement, or a piece of geography. People include those of different races, different personalties, and different backgrounds. Situations involve the combinations of different types of people and places. For example a slave auction, a king's court, a merchant caravan, the guards at the city-gate, show night at the tavern, etc.
When you do this will you find that you don't have very many elements for certain areas. Back in the day, you would go to the library and read up. In this day, you have the internet, wikipedia, and tons of free material out there. Some of the best tools to use are a well organized set of random tables to use as an idea generator.
While experience certainly helps to build up your bag of stuff, the good news that we all have it already. You just need to organize your mind to get at what you know. And of course read, watch, or experience as many things you can to build it up for the future.
The biggest different between me and the person just starting out refereeing a sandbox isn't the fact I have 30 years worth of detail for my setting. Is that the fact I accumulated so much in my bag of stuff that I rarely get fazed by what my players do.
There are two major things that helped me realize that I have a bag of stuff. For 25 years, Tim and Dwayne getting exasperated at me while looking things up and telling me "Rob! Just make it up." And playing two different forms of roleplaying, Live-action roleplaying (NERO), and MMORPGS (UO, Everquest, WoW, LOTRO, etc).
Sample Dungeon in Gridmapper
11 hours ago