Say a golem (stone, if it matters) is guarding a tomb. His instructions were "Kill anyone and anything who disturbs this tomb". In fact, let's assume that the orders the golem is following are perfectly clear. How would the golem react to invisible tomb raiders? The golem doesn't have blindsight. It doesn't even have spot or listen skills. Would the golem attack wildly if the tomb was opened? What would it do, how would it react?
It wouldn't react at all. A golem is totally unintelligent - it can't think for itself, interpret or improvise. If it's instructions don't include what to do if an invisible creature breaks into the tomb, and it cannot identify that whatever is disturbing it's charge is in fact 'anyone or anything' then it would stand there and do nothing and continue it's watch.
It's the golem equavelant of getting an error message on your computer. It just says to itself .."well, that's not working. Oh well" and goes back to whatever it was doing before.
If the golem does somehow detect those responsible (I believe a roll of 20 would allow it to see an invisible moving opponent), then it can attack.
See, no. Detect the presence of, yes. In which case the golem would react accordingly, as per it's instructions. Were I the golem's creator and set it to guard this tomb, I'd include the instructions ~ "if you detect the presence of someone you cannot see, close the entrance to the tomb and stand to block the doorway from the inside." Then the little buggers can either fight the golem or just sit there and starve to death. Either option is good. ^_^
A golem fights back when attacked. What if it's being attacked by an Invisibly Improved fighter? an Invisibly Improved fighter with a 10' reach weapon? an Invisibly Improved wizard pelting the golem with the appropriate spells?
Well, since the golem is taking damage, it's aware that there's someone or something present. The fighter's reach weapon doesn't do much, as the golem itself also has reach - the fighter isn't nearly as safe as he thinks he is. But yeah, I'd say the golem would react based on it's instructions. For example, in a game I ran a while back I had some low hd wood-and-brass 'warehouse' golems working in this large mage's storage building. One of their instructions was "if you encounter a situation that you cannot understand, go and get the foreman." If the golem in the scenario is on it's own *shrug* dono, maybe have it be instructed to minimize it's exposure (get in a tight hallway for example), and then just methodically sweep the area until it hits something squishy.