1. Do you have a blue pen, Tom?

2. Sure, I have a lot of them.
[Is #2 correct? Does 'them' refer to 'blue pens'?

3. Do you like the color blue?
4. Do you like blue?
5. Do you like the blue color?
[Which one is not grammatical of the three?]

nope

1. Yes, in this case, "them" is referring to the blue pens. So, the sentence is correct.

2. Great, it seems that Tom has multiple blue pens.

3. Both sentences 3 and 4 are grammatically correct and have the same meaning. They are asking whether you like the color blue.

4. Sentence 5, "Do you like the blue color?" is not grammatically correct. The correct phrasing would be "Do you like the color blue?" The word "blue" is already acting as an adjective describing the color, so we don't need to add "color" after it.

1 and 2 — yes and yes.

3, 4, and 5 are all grammatically correct but 5 doesn’t mean exactly the same thing as 3 or 5.