Compaq Presario CQ40-401AU is design for windows vista. Installing windows XP driectly using original windows XP CD will result in Blue Screen Error or " No hdd was found".
There is a famous trick to solve this problems which know as slipstream guiide to install windows XP. Slipstream process is not too difficult but for this model which use AMD sata drivers it can be a little bit tricky.
You can read how to slipstream guide here, something worth to mention is:
1. Make sure to use right sata drivers.
2. If you are about to repeat the process, delete all folders and create new folder.
3. If you failed 2 - 3 times, that normal.
4. Windows XP SP2 is preferable.
TUTORIAL LINK: Slipstream Guide to Install windows XP