Yours is a variation on a very common idea that’s been cropping up lately.
Unfortunately, there are a couple of problems with it.
On a network but not the internet is difficult
First, I’m just not aware of an easy way to make this happen.
I believe the normal solution would take a more complex router than most people have. It really is a routing issue, I believe, since it’s the router that would need to block your XP machine’s attempts to connect out to the internet. Perhaps there’s a hack out there that I’m unaware of, but it would seem that any such attempt would be complex at the least, risky, and perhaps even fragile.
And it wouldn’t really get you the security that you think it might. It’s like an old adage you may have heard in high school health class. When you kiss someone, it’s like you’re kissing everyone they have ever kissed (at least I think it was kissing). Anyway, the point that your teacher was making was that human bacteria and viruses spread through contact. The same is true for computers; and that’s one reason we call viruses viruses. They replicate and propagate through contact.
Now, eliminating internet connectivity from your XP box does make direct contact to the internet go away. However, it leaves that machine connected to your local network, which means it leaves that indirect contact in place. So, yes, your XP box could still be vulnerable to things that come in through other systems on your network. It’s a much smaller possibility, but it is a possibility that most definitely remains.
Networking is not the only way your XP machine could become infected. Transferring data back and forth via USB sticks is another possible vector. But being connected to your local network is definitely something that makes the machine more vulnerable than you’d really want it to be.
Disconnecting from important updates
And of course, removing internet connectivity from the XP box means any anti-malware tools on the Windows XP machine will not be able to keep themselves up to date: they won’t be able to update their database of malware definitions.
Microsoft Security Essentials (for XP) will continue to be updated for at least another year, and other anti-malware tools perhaps even longer than that. Given the risk of secondhand infection anyway, you still want that anti-malware tool updated.
So, in a case like this, my recommendation is: keep your XP machine connected to the internet; turn on the firewall, make sure your anti-malware tools are updating themselves regularly, and then use that machine for as little as possible. This is, perhaps, the single biggest thing you can do to reduce the exposure.