If I install Windows XP as a Virtual Machine with no network connection, is it safe from being hacked? My main OS would be Windows 8.1 with internet.
No - because your VM is inside a machine connected to the Internet it is not safe.
It is protected, yes, but that protection is only as good as the protection the host machine provides.
An attack could compromise the host machine via its connection, subvert the hypervisor and compromise your VM. Read this question and others in the Related sidebar to the right.
The only way to make a machine "safe" from being hacked is to have no Internet connection, no ports, no USB, no hard drive, no keyboard...in fact you'd need to unplug it, remove its RAM, bury it in concrete, etc...
This is the reason for a lot of the clarification around "safe" - you can make a machine sufficiently safe for what you want to do with it. It would require a lot more detail than your question provides.
It is as safe as a Windows 8.1 machine with an internet connection.
Since the VM has no network, the only way to access it would be through the host machine. If the host machine is compromised, you can consider any VM running on it to be compromised as well.
The only machine completely safe from being hacked is the one that is unplugged, switched off, and locked in the basement (actually, that isn't even safe if the attacker is able to get into your basement). If you want to actually use the machine, all you can do is add enough security deterrence so as to make it more trouble to hack than the value of the machine is worth to the hacker. Any system can be compromised if the hacker is willing to go to the trouble.
Update after a little more thought: I want to elaborate on what we mean we say a system is "safe." It isn't a binary thing. What you really have is a ratio of worth/trouble (as in, "is it worth the trouble?") In general, we can call a system "safe" when that ratio works out to a value between 0 and 1. That is, the trouble is more than it is worth. You need to be really careful when making that designation, though, as the values you assume for worth and trouble may be different depending on who you are dealing with ands what you are protecting. An attacker on the other side of the globe will have more trouble than one who already sitting at your keyboard. A computer with lots of valuable personal and financial data will be worth more than one that doesn't. A computer that only has family pictures may be worth more to a hacker with a weird desire to collect such things, than to the rest that don't care. And don't underestimate the worth to a hacker that is just bored and wants to see what they can do.
So I have to answer your question with a question: What are you protecting and who are you protecting it from? Putting it on a VM increases the trouble value a little bit, but not by much if you don't take any other measures. Does your worth/trouble calculation come out to more-than, or less-than 1 for the hackers you think you are likely to encounter?