I've always dived in a team of three, so it's always a bit surprising to see how often this question is posed.
Yes, a team of three can be very safe, and in fact is preferred by some (including myself) because it provides additional resources, particularly when things go south (if two people are involved in an air-share, the third can take the lead and help captain the ascent/exit).
It does take a bit more practice to get used to managing a team of three; everyone has to be on the same page, and it's even more important that nobody breaks away from the team without signaling the other buddies. Especially when you're just starting diving, it can be task-loading enough to keep track of one buddy, so keeping track of two can take even more effort. But it can be done, and once everyone gets the hang of it, it's every bit as easy (and perhaps moreso) than diving in just a pair.
As an aside, at least for me, three seems to be the limit. When you get to 4+ divers, all of a sudden you're not really diving with buddies, you're diving in a big group, which is generally not a good idea because all of a sudden nobody has a particular responsibility to any other specific diver; keeping track of any one person becomes a "group responsibility," which often translates into no responsibility. When 4 people dive together, it's almost always better to sub-group into two teams of 2, and make sure the buddy pairs stick together even if the other divers get separated. With 5, it's better to split into one group of 2 and one group of 3, etc. Just my $0.02.