If you are on a bare-metal machine, you should be able to do that as root.
echo 0 | sudo tee /sys/devices/system/cpu/cpu0/online
You may get errors due to the kernel not being able to hot-unplug a core. In that case, you can look for more info in the dmesg log or else go look at the kernel code to see what the error might be.