I would like to use iMac as a display, but without loading an OS I have a late 2009 27" iMac, but recently the internal hard drive completely died. When I try to power it up, the iMac gets stuck on the white Apple loading screen. So instead I would now like to use it just as a display. 

Is there a way to do this without replacing the internal hard drive? I have used it as a display before when it was working, so I know it can be used that way.
If your main priority is just not to replace the HDD, why not install macOS onto a USB flash drive and use that purely so you can use the iMac in Target Display Mode?

To do this, follow these steps:


Boot your iMac from the USB flash drive 
Ensure the other Mac is also booted up and logged into a user account 
Connect the two Macs with a Mini DisplayPort or Thunderbolt cable 
Press Command F2 on the keyboard of the iMac (i.e. The one you want to use as a display).


For more information you should read Use your iMac as a display with Target Display Mode