....Well, you can't keep a pair of Betta Splendens(assuming thats the species your referring to)together without a divider unless for a short period of time for breeding. Thats a disaster waiting to happen. It may be possible in a heavily planted 100+ gallon, but only the most experienced should attempt that....and its still a huge risk.
You can have a male and female in a tank if there is a divider
between them, just make sure its secure. The smallest tank size that can be divided is a 5 gallon, though 10+ gallons is always better.
If you don't want to divide, you could always try a female Sorority
, but even those can be risky.
A single betta of either gender in a community of 10+ gallons would be just fine, but be prepared with a 2.5 gallon + spare tank in case your betta doesn't take to having tank mates and/or gets picked on and choose tank-mates carefully.