(I'm guessing you've tried holding down the mouse button for 20 seconds on startup?)
Those links above are for the wrong iMac, but rest assured, I was doing this on a 800mhz iMac G4 last night...
Take a strong paperclip or ring of metal (from an old key ring, etc.) and bend it into a lowercase f shape. You are going to need to do some poking, but the button you're looking for is about 1cm down below the cd tray and 1.5 cm in from the right hand edge. It's extremely difficult as there's (probably) a thin black plastic cover over the lower part of the drive and the button is also recessed slightly, so it doesn't protrude or anything. The method I have found works best is to lower the paperclip in to roughly the right position and then twist the f shape so that the bent end is pivotting into the recess area to hit the button (which isn't that recessed, but makes "feeling" for the button with the clip nigh on impossible).
If you look into the lower part of the drive, you may be able to see the green board of the optical drive... the button is above this and you should be careful not to go too low with the paperclip.
If you have any thermal paste handy, it might be easier to 'pop' the iMac open and gain access to the optical drive (and the button) from there. I only say this as 18 (4, then 4, then 2, then 4) screws stand between you and the optical drive in your hand?!?
You could also use the command screen to list the available drives and eject from there using whatever name you're given?