My 2004 2500 did this as well. Random! I actually watched it happen.
Look in window - Alarm active.
Press unlock - Alarm stays active.
press lock - alarm de-activates... !!!!!
press unlock - alarm activates.
ROCK & HARD PLACE
Open door for maximum embarrassment.
The problem was 'fixed' in my 08. BUT, the manual key no longer de-activated the alarm, or unlocked the passenger door with a second turn of the key......sorta like my 10 is. Although the 04 surprised me numerous times, I sure felt it was a better system than what I have had since.