Looks like it is a sign you might not be as close to your boyfriend as you though maybe? Maybe your mind is trying to tell you secretly you want to be with someone else? I do not know the whole story, but in my mind that is how I see it.
In regards to being attached to someone who isn't your boyfriend, in general it is somewhat of a risk to get attached to anybody... friend or lover.
By doing so, you will inevitably feel hurt and loss when it ends. However, logically we can not go through life without forging any bonds with people, so you could say that the 'smartest' way to form bonds with people is by gauging whether that person intends to stay in your life.
Who should you get attached to?
Whether they do or not, due to unforeseen circumstances is something that we just can not alter or amend, but if we make the choice to attach ourselves to the people that we know will not be there, then ultimately we will end up blaming ourselves.
So in response to your question, it might not be the wisest thing to attach yourself to somebody who does not want to be with you.
But if he does, and he's not your partner due to other reasons that can be circumnavigated, then perhaps it is worth the pair of you giving it a shot to see if you can make it work. Just be sure that he wants the same thing as you do before you put your heart into it.
I hope this helps.