Just as mitkoto and Jtom2k have said, it depends on the game. But the reason why we play solo or with a team is not restricted to the game, because our emotions when playing and understanding of the game will change the way we play.
In some games playing as a team is compulsory; it is the core element of the game. One of the first games that I think of when team is mentioned is the ubiquitously played game: League of Legends.
League of Legends forces players to play as a team and encourages both communication and teamwork. The only option of solo play in the game is in the custom game mode which, to be honest, isn't the way the game is most likely played. Therefore, team play cannot be avoided. Though the game does group players into teams of five, there is always the option of solo play during the actual match. This however is shunned upon by much of the League of Legends community because it defies the ethos of team play and team work. This is one example of a game where solo play in a team game creates a significant disadvantage for the team with the solo player, which is justified given that League of Legends is built on team work.
However, there are games where solo play in a team environment is encouraged and could actually prove beneficial for the team. Such examples include the Call of Duty games and Titanfall where the skills of the individuals in a team are comparatively more important than team work and team play. Though in recent years the developers of such games are introducing new multiplayer modes that encourage team play (e.g. Uplink in Call of Duty and Crosshair in Battlefield: Hardline to name two), the modes still have a focus on the individual skill of the player. One may think this is exclusive to First-person shooters, but other first-person shooters have team work as the paramount element to success. Games such as Arma, Operation Flashpoint and Rainbow Six: Siege emphasise the importance of team work more than individual skill. Therefore, just as others have said, it is dependent on the game.
Apart from the game, however, there are other variables that influence whether we play solo or as a team. One of these variables is the player's emotions. Studies have shown that at the time of playing a game, a player who is angry is more likely to play individually/solo because their anger leads to isolation as well as a a tendency not to communicate with others. On the contrary, other studies have shown that players that are happy will more likely apply themselves to a team and communicate within it. In these situations, the player may choose a game that suits their respective emotions. Although the decision to play a certain game is not entirely dependent on human emotion, at the time, emotions can influence what and when we play.
Another variable, as previously mentioned in the question description by MassMonkey221, are the availability of friends when playing a team game. It is common for people not to attach themselves with a team consisting of strangers (more frequently in some game environments than others); because they are strangers, people tend not to apply themselves into a team, especially if the game is reliant on the use of a microphone. One of the most important consequences of the use of a microphone is the removal of the player's anonymity and banality. The removal of a player's anonymity and banality can cause them to deliberately play solo because they would otherwise deviate from the socially constructed norm. But within a team of friends, players are more open and more communicative because they are people they know; they aren't strangers. So players would, in most cases, join a team of friends than a team of strangers. However when friends are absent, the player may not join a team of strangers at all. If a player does join a team of strangers, they may be uncommunicative and use them only as a tool for game progression. These scenarios are, of course, restricted to certain games and mainly refer to MMOs and Shooters with a squad system within a team, etc. Not everyone will behave this way, some players are very social and vocal, but most, in my opinion, aren't.
Ultimately, the decision to play solo or within a team depends mainly on the game, its environment and emotions. Although the question was significantly intended to be a more simple, 'Which do you prefer?' type, I wanted to try and tackle some of the inherent, unnoticed and unmentioned variables that might affect the games we play.