visual studio 2019 remove an azure devops connection

You can right-click the repo you want to remove, and then select the Remove option. It should be noted that once a repo is added, VS cannot remove the repo by default unless there is another repo, e.g in the figure below, I also have a local repository below. You have to switch to another repository to remove the current one, otherwise the displayed remove option will be unusable. enter image description here

Repeating the comment below because it's easier:

If you go to Team in the menu and select 'Disconnect from Server', then you are allowed to delete a connection without the need of creating a new connection"