I am Norwegian and answer this in a more general manner. As far as I know this applies to the UK too, as well as other Parliamentarian countries.
First, as @SleepingGod says, Independent is not a party. They are a bunch of people who do not agree on much except that the major established parties are no good. In this context, there is really no difference between an independent and a party holding a single seat.
Regardless, what matters is that the new PM "commands the respect of the house". This means that they must win a vote of the Parliament, called the investiture vote. In the UK there are 650 seats, but some are likely to abstain. The prospective PM needs more votes in favor than against.
If no party has a majority on their own, they need to form alliances.
Of course, this is easiest for the largest parties, so the custom is for her Majesty to ask the leader of the largest party first. However, even they have answer whether they have a majority alliance behind them. If they don't the second largest party is asked and so on. (If anybody lies, they will be found out in the actual vote. Much embarrassment will be had)
Of course, all this is a formality, her Majesty knows very well who has the required alliance and she will not start her interviews before the necessary deals have been made.
Now, what happens if nobody is able to form such an alliance? If enough minor party members refuse to ally with anybody?
In the UK and Norway, that has never happened... yet. Negotiation continue until eventually somebody gives in. Usually after getting support for some of their pet causes. However, there is always the next election.
In Belgium, they were without a cabinet for more than a year in 2010-11.
In Norway there was an interesting case in 2001 where the Prime Minister came from the fifth largest party at the time. Various ministers came from three parties, second, fifth and seventh by number of seats. The also needed the support from the third largest to get the majority, but they got no cabinet positions. They were might pissed off about it, but accepted the result as a Lesser Evil. (There were probably some other deals made that I don't remember)
I don't know UK politics well enough to know of similar cases there.