Preheat the oven to 425 degrees.
Prepare a baking sheet with parchment paper or a silicone baking mat.
Add the tomatoes, garlic cloves, and shallots, cut into wedges, and add 2 sprigs of rosemary.
Roast for 20 minutes until the tomatoes burst.
In the meantime, add the white beans, red pepper flakes, vegetable broth, and 2 remaining rosemary sprigs to a soup pot in a dutch oven.
Bring mixture to a boil and reduce to a simmer.
Add the roasted tomatoes, garlic, and shallots.
Remove the sprigs of rosemary from the baking sheet and the soup pot.
Using an immersion blender, blend the soup until smooth—or transfer batches to mix in a high-speed blender.
Serve with optional cubes of sourdough bread.