If you strictly want to use the .prepend(), the following will help you:
// this gives you a list with all matching elements
var elementsList = $("li");
// this refers to an element at required index and wraps it into a jQuery object
var elementAtIndex = $(elementsList[your index]);
// and finally apply change
elementAtIndex.prepend("<li id=\"4\"></li>");
OR
The same, using .eq(), which will be more elegant after you got the main idea. .eq allows you to refer at particular index.
var elementAtIndex= $("li").eq(your index);
elementAtIndex.prepend("<li id=\"4\"></li>");
And finally we came to the final short variant:
$("li").eq(index).prepend("<li id=\"4\"></li>");