It can be made to work, but it would be quite different from the typical SF depiction.
As Blake points out, you can't gain anything from mass that is already moving faster than rocket exhaust. However, you do not have to collect the gas at orbital velocity. In the extreme case you could slow to a complete stop and refuel while landed, as long as your fuel tank is big enough to allow a single stage to orbit.
There are serious plans to refuel that way on Mars (~5 km/s) using current technology, so nothing impossible there.
Earth (~10 km/s) is close to the practical limit for a single stage - enough that we've never actually built one, but it could be done if there weren't better options available.
Assuming that refilling the tank takes less than a year, there should be some point between orbit and the ground where you don't have excessive drag, but also don't have to empty the tank to get back to orbit.
Nuclear rockets
Using chemical rockets is probably not going to work - I prefer to avoid atmospheres composed of perfectly mixed rocket fuel and oxidizer - so I'll start with a nuclear thermal rocket that has similar performance to H2/O2 but will burn anything that can be sprayed onto hot rocks. That doesn't exist, but seems reasonable with current technology.
I'm also going to assume separate fuel gathering ships rather than a small add on to a larger ship - burning 90% of the collected fuel to return to orbit only gets you a full tank if you can make ten trips.
Mars gets closest to basic atmosphere skimming - orbital velocity is lower than exhaust velocity, so you don't need to slow down to gain a small amount of fuel on each pass through the atmosphere. Completely filling the tank may be possible.
Earth requires slowing to at least 4 km/s below orbital velocity. You'll need a very fast pump, as you have to either produce enough thrust to hover or fill the tanks in the few minutes before you hit the ground or thick atmosphere. Getting back into orbit will use up at least half of the collected fuel. Starting with enough fuel to return to orbit isn't really an option, so the pumps will need to be very reliable as well as fast.
Jupiter requires slowing by 10 km/s, so there is really no margin for error. Each trip into the atmosphere uses up 99% of the collected fuel - you need hundreds of flights to fill the tank, and abort to orbit isn't even a theoretical possibility.
Chemical rockets
Fully fueling a chemical rocket this way probably isn't going to happen. If you do find all the necessary elements in one place, it is probably as water. The energy to process that into rocket fuel probably means a nuclear reactor, which you may as well just use more directly.
Collecting only the heavier oxidizer is more reasonable, but probably not worth it in most cases - even if Jupiter had a pure oxygen atmosphere you would be using 99 tons of hydrogen to get 8 tons of oxygen.
On Earth you might be able to come out ahead - Starting with 100 tons of hydrogen you could collect 800 tons of oxygen and return to orbit with 50 tons of hydrogen and 400 tons of oxygen.
Engineering challenges
The rocket itself is relatively easy - several suitable designs already exist, although nothing flown.
To store the collected fuel, you need something about the size and weight of the space shuttle external tank, which is easy enough, but it also needs to be able to survive reentry, possibly hundreds of times, without adding too much mass to get back to orbit.
To fit a useful amount of air in the tank, you probably need to liquify it. A high pressure tank may also work, but is likely heavier. Either option generates a lot of heat. That isn't usually a problem, but you are trying to do this while flying at mach 10 attached to both a nuclear reactor and a rocket engine.
Would it ever be worth doing?
On Earth, it might happen if sufficiently reliable technology was already used for something else, but otherwise there are better options. Using a falcon style ground based first stage gets you most of the benefits with none of the risk.
An Earth-like planet without infrastructure could make sense, but you are probably better off landing - use a rocket that can reach orbit empty or act as the first stage for a large load of fuel.
Venus actually makes it a look like a decent option - mid air fuel production is just as dangerous as anywhere else, but the surface environment manages to be even more unpleasant.
Jupiter needs either a lot of flights or a lot of ships. If you have sufficient local infrastructure to support a hundred ships, you may as well build a space elevator or something. Without that, entering the atmosphere of a gas giant is reserved for the truly insane starship captain who somehow missed all the moons and ring system full of easily accessible water ice.