Although it is good to be friendly, do not spend too much time chatting to colleagues. You have work to do. If a colleague is distracting you , be polite and say you have some work to do.
Ask if you can carry on the conversation after office hours.
The excerpt is a kind of some useful advice about