Would you say (a) "I don't think I'll go somewhere" or (b) " I don't think I 'll go anywhere"?
I have learned that with a negative sentence you use anywhere. But, here the negation is in the main clause not in the dependent one, so is (b) still gramatically correct ?
Both seem correct. What do you think?

I suggest you don't rely too much on what is correct to say. Usually it's a matter of what you mean to say. In a certain context it could be that "somewhere" would sound better than "anywhere" even in a negative clause. For example, "I didn't say the book is somewhere around. In fact, I don't think it's anywhere around."