GM ruling covers this: line of sight may be obscured
The rules don't specify whether the flaming sphere opaque or not, but there are some rules that can help the DM make a ruling on this situation (italic emphasis mine):
Making an Attack (SRD p. 94):
- Choose a target. […]
- Determine modifiers. The GM determines whether the target has cover and whether you have advantage or disadvantage against the target. In addition, spells, special abilities, and other effects can apply penalties or bonuses to your attack roll.
The GM makes a ruling on cover (yes/no) and how much cover(half, 3/4, total). What is available to assist in making this ruling? Cover and Vision rules offer some help.
Cover (p. 96 SRD):
A target with half cover has a +2 bonus to AC and Dexterity saving
throws. A target has half cover if an obstacle blocks at least half of
its body. The obstacle might be a low wall, a large piece of
furniture, a narrow tree trunk, or a creature, whether that creature
is an enemy or a friend.
A target with three‑quarters cover has a +5 bonus to AC and
Dexterity saving throws. A target has three‑quarters cover if about
three‑quarters of it is covered by an obstacle. The obstacle
might be a portcullis, an arrow slit, or a thick tree trunk.
A target with total cover can’t be targeted directly by an attack or a
spell, although some spells can reach such a target by including it
in an area of effect. A target has total cover if it is completely
concealed by an obstacle.
But the fire isn't solid, is it? (Neither is a portcullis, but I digress). You could shoot through the fire if you see some of the target behind there. But is there a penalty to the shot, since you can't see the whole target?
Look at the situation and decide if the flaming sphere provides some, a lot, total, or no cover.
- How much of the target can the Ranger see?
- How big is the target as compared to the flaming sphere?
- Does the Ranger have some room to move to get a better look before
releasing the arrow?
It will depend on the situation. In a 5' wide hallway, you could make the case for 1/2 cover, while in a large room where a Ranger can step to either side there may be no cover at all.
Why "cover" from a non-solid object?
Obscured vision. Is the target partly obscured by this big old ball of fire?
Vision and Light (SRD p. 86):
In a lightly obscured area, such as dim light, patchy fog, or moderate foliage, creatures have disadvantage on Wisdom (Perception) checks that rely on
Foliage isn't opaque, per se, but it can certainly obstruct vision. You could consider the flaming sphere something like a burning bush: if not opaque, certainly an obstruction to vision.
Combine "obscured" with "cover" and you can make a good case for 1/2 cover in a situation where the Ranger can't move to get a clearer look at the target. I'd have a harder time arguing 3/4 cover or total, since the flame isn't a solid object.
Make a ruling, and play on!