This is a frequently requested feature, you should be able to find some older discussions with search. Some people have succeeded in doing this with hardware (essentially leave the mechanical bits connected or connect suitable dummies, but don't put them in front of the sensor)
As far as I know, no one has succeeded in doing this with software.
First way can be telling to the chdk boot that the camera is a camera that has no motors in the definitions.
If the camera has no motors never tries to use the optics.
Practically speaking, this is meaningless. There is no one place "has motors" is defined in the camera firmware. There are various functions that interact with the hardware all over the place, and the entire firmware is based on the assumption that these things exist.
Second way is to change the functions that return the status of the optics, the functions must lie, never check the
status and always return ok.
Because CHDK does not modify camera ROM, you cannot generally change a specific function. Nor is there one specific function that checks the status, as above, there are many places that interact with the mechanical hardware. It's also not as simple as status OK, for example, a function might try to drive a motor to a specific position, polling some other hardware to determine when it is there...
If you were willing to write the ROM, you'd have more options, but you are likely to permanently destroy a significant number of cameras in the process. I guess if you got ones with damaged optics off of ebay etc. this wouldn't be so bad. This is something I would be interested in experimenting with (assuming cheap/free damaged cameras to play with) although I don't think it would ever be an official part of CHDK. Users would inevitably brick their cameras and blame us.