Very often someone's (negative) behavior toward you is not a reflection of you, nor is it about you.
Their action or response toward you is about something internal: a limiting world view; a sick family member; financial stress; chronic guilt; lack of sleep; fear that they are not leading well; feeling inadequate; doubt about their career track...
Remind yourself of this before replying to the other person. Doing so may help you see the situation in a different light and give you insight into a better approach.
And, if you recognize something you said or did that was a trigger, acknowledging this with the other person (and apologizing if appropriate) can get an awkward or difficult situation back on track.
P.S. It never hurts to sincerely ask someone how they are doing (even at work).