I recently started playing Black Ops II on my PS3 again. A few months back, we had thought our PS3 had kicked the bucket, but it turns out it started working again, and didn't give any problems since. However, when I start playing Black Ops II, about 30 minutes to one hour into gameplay, the PS3 will get the Yellow Light of Death and shut off. I told my brother about this, and he insisted it was because there was stuff behind the PS3 and it was not receiving proper ventilation. I told him this was not the case, because I ran the PS3 for 3-4 hours on Netflix and YouTube, and it did not get the Yellow Light. After he cleared the back side of the PlayStation and tried playing Black Ops II, he still got the same problem I did. We have many other games, such as GTA IV, Minecraft, NBA 2K14, but when running these games, none of those problems occur. What could be causing the Yellow Light?
YLOD is, apparently, often caused by the not-so-good thermal paste on the CPU and RSX chips. (I know nothing about PS3 gaming but I looked up the YLOD and found this information.) It obviously isn't faulty hardware if other games work fine.
Try using isopropyl alcohol to clean the thermal paste off the aforementioned chips and replace it with something like Arctic Silver- tutorial here. If that doesn't work, I honestly don't know what the problem is. Good luck!
Please note that the accepted answer is misleading, as changing the thermal paste will only help with thermal problems and not a hardware failure, that is what the YLOD means.
Most of the times the YLOD happens because a the NEC/TOKIN capacitors have gone bad, meaning that the CELL and RSX chips are unable to get stable power to continue working on highly demanding games like Black Ops 2.
The only solution to fix the YLOD in this case would be to replace the NEC/TOKIN capacitors on the console's motherboard. There is a well known guide for doing this procedure at PSX Place that can help you if you want to do this repair yourself. Otherwise, you should send it to a repair shop.