Psychological deterioration, due to prolonged isolation
In this interview, when asked about inspirations from other films, Will Smith said:
What we were trying to do was to completely remove genre; so let’s look at the psychological deterioration of the character and let’s make the small art film version of this movie and then put all of the other elements – the blockbuster packaging – around it.
So he feels that the character is struggling to cope with the situation.
However, later in the same interview he says:
We did research with people that had been in solitary confinement and the two things that came out were that everything has to be scheduled. Even if it’s I’m going to clean my nails from 9 to 9.45, and then from 9.45 to 10.30 I’m going to look at the ceiling.
The above quote might suggest that someone like Robert (i.e. military background) should have had a sidearm with him.
Robert Neveille tries to maintain a routine (going to the bridge, working out, researching etc.), but is still fighting against isolation in a world he is trying to fix.
He makes several lapses in judgement (thinking the mannequin is real, getting caught in his own trap), and it seems reasonable that one day he simply forgot to take his sidearm.