Can you use Singularity if your opponent only has 1 unit and I have 3 units?

Yes, you can use Singularity in that situation.

According to the RiftJudge FAQs (specifically FAQ #7105, #2714, and #3483), "up to two units" means you can choose to target 0, 1, or 2 units. Because the card allows you to target "up to two," you are not required to have two targets available to play the spell, nor are you required to target your own units if you do not wish to.

If you choose to target only the opponent's single unit, that unit will take 6 damage. You are not forced to target your own units to reach the maximum of two targets.