If the battery is dead (and it can happen even in new machines) then that's the problem...I don't know how hard it is to change the battery on an iMac, it used to be quite simply on older Mac's.
If the battery is not dead I suggest going through the entire old routine of zapping the PRAM, etc. If that doesn't help, then I would try re-installing the system, or better yet going back in time with Time Machine...or any other back-up you must have.
If non of the above work, then take your mac for a ride and visit the Genius Bar.
Keep us posted.