The solution I came up with checks the left and right side, to make sure the left side is flattened and the right side for all possible partitions.
The equation for partitions has some errors for when I check a double nested element.
unflatten([],[]) :- !.
unflatten(flatList, [l1|lst]) :- !, unflatten(A, l1), unflatten(B, lst), append(A,B, flatList).
unflatten([l1|flatList], [l1]|lst]) :- unflatten(flatlist,lst).
unflatten([l1,l2|flatList], [[l1,l2]|lst]) :- !, unflatten(flatList,lst).
unflatten( [flatList],flatList):- !.