Ranged or Melee Attack
Each attack is classified as Ranged, Melee, Area, or Close. You can look at the power description to see. If it says 'Ranged 5', then it's ranged. A melee basic attack is Melee.
Ranged or Melee Weapon
If an attack has the Weapon keyword, then you'll need to use a matching weapon. A ranged weapon for a Ranged Weapon power, a melee weapon for a Melee Weapon power.
Using a Ranged Weapon as a Melee Weapon
So, to do a melee basic, you need to use a melee weapon. A bow is not a melee weapon, but it could be used as an improvised melee weapon. In other words, he would just hit him with the bow, not shoot an arrow.
One-Handed or Two-Handed
There could be some room for interpretation on whether the bow is a one or two-handed improvised weapon, but it appears that RAW would require you to use it as a one-hander. There's not a ton of guidance on this, but the Player's Handbook does say that "A one-handed weapon is light enough or balanced enough to be used in one hand. A two-handed weapon is too heavy or unbalanced to use without two hands". The bow weighs only 2 or 3 pounds, and the improvised weapon table implies that anything under 6 pounds would be a one-handed weapon.
That being said, a longsword is "light or balanced enough to use in one-hand", but since it's versatile you can use it as a two-hander if you choose. If I was your DM, I would allow you to treat a longbow as versatile.
Attack and Damage
Two-handed improvised melee weapons do 1d8 damage, but have no proficiency bonus, so your attack modifier would be lower than a real weapon you're proficient with.
If you have features that work with one-handed weapons, or if you can't use it two-handed because it's too light, you can use the bow one-handed. Unfortunately, improvised one-handed melee weapons do only 1d4 damage, the same as a dagger. So, the dagger would actually do more damage than the bow would one-handed, because it would be more likely to hit.
If the bow is versatile, then the damage would be 1d4+1, which is still less than a full-fledged two-handed improvised weapon, but would allow you to apply any features or powers you may have which rely on using two-handed weapons.
You could also just punch with your free hand while holding the bow in the other hand. The bow requires two hands to fire, but you can just hold it in one. Unless you have some special features like a monk, punching is an improvised melee weapon and also does 1d4 damage with no proficiency bonus.
Using a Dagger on the Attack
In order to attack with a dagger on an opportunity attack when the dagger was not equipped, you would need to be able to draw the dagger either with a free action or as part of the action. The Quick Draw feat would allow this, as would some class features.
Unable to Attack
If the character is unable to attack for some reason, then they would be unable to attack. So yes, they would skip the free attack. However, since you always have a melee weapon in the form of your hands, this would never be because of a lack of a melee weapon. If you were out of melee range, or unable to attack because of some condition, then you would skip the attack.