Running Windows on your Mac's hardware makes it possible to run virtually any program, regardless of what platform it was coded for. While virtualization is a closer-to-seamless approach to this, Apple's built-in Boot Camp feature offers a quick way to set up Windows in a secondary partition. When you run the Boot Camp Assistant, the system will create a partition to use, and then install Windows from your installation media. However, when doing so you may run into a problem in which the Windows installer claims, "We couldn't create a new partition or locate an existing one."
This problem appears to be specific to Windows 8, and may be more likely to happen if you are trying to install Windows from a thumbdrive.
It happens because the presence of a secondary external drive is confusing the Windows installer, so a quick solution is to make sure all USB, FireWire, and Thunderbolt-based storage media are disconnected from your system during the boot process. Often Mac users will have a Time Machine drive connected to their systems, so unmount and unplug this and any other drives from the system before installing Windows.
If you are attempting to install Windows 8 from a thumbdrive and the error continues to happen, then consider burning the installer to a DVD or try transferring the installer to another external storage device and make sure only that device is connected during the installation process.