Maybe you were too close to the subject or there was no enough scene contrast, check the minimal focusing distance and get further away from your subject. Also, focus in areas of contast, this helps a lot. If neither works, try manual focusing (I think the SX 40 has that).